<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Metatags_model extends CI_Model {
  private $table = 'metatag';

  public function __construct() {
    parent::__construct();
  }

  public function get_node_tags($nid) {
    $this->db->select('data')
      ->from($this->table)
      ->where('entity_type','node')
      ->where('entity_id', $nid);

    $query = $this->db->get();
    if ($query->num_rows() > 0) {
      $result = $query->result_array();
      $result = unserialize($result[0]['data']);
      return $result['keywords']['value'];
    } else {
      return false;
    }
  }
}